//
//  CourseForecastTableViewCell.m
//  ECBBusinessCamp
//
//  Created by rimi on 16/6/17.
//  Copyright © 2016年 邓毕华. All rights reserved.
//

#import "CourseForecastTableViewCell.h"


@implementation CourseForecastTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}



#pragma mark -- btn --
#pragma mark --
//报到
- (IBAction)applyBtn:(UIButton *)sender {
    NSLog(@"报到按钮%@---%@",_classId,[LoginUserInfo defaultUserInfo].userid);
    [self applyData];
}

- (IBAction)shareBtn:(UIButton *)sender {
    //分享btn
    NSLog(@"//分享btn");
    _shareCallBlock();
    
}
#pragma mark -- private methods --
#pragma mark --
- (void)clickShare:(ShareCallBlock)shareCallBlock {
    _shareCallBlock = shareCallBlock;
}



#pragma mark -- 网络请求 --
#pragma mark --
- (void)applyData{
    
    _applyDataload = [NSMutableDictionary dictionaryWithObjects:@[_classId,[LoginUserInfo defaultUserInfo].userid] forKeys:@[@"classId",@"id"]];
    
    [[NetTool sharedTool] requestMethod:POST loadingMsg:@"加载中..." url:BASEURLAPPEND(COURSEFORECASRAPPLY_URL) parameters:_applyDataload finish:^(id responseObject, NSError *error) {
        NSNumber * status = responseObject[@"status"];
        NSLog(@"%@",status);
        if ([status intValue] == 1) {
            [MBProgressHUD showSuccess:@"报名成功"];
        }else{
            [MBProgressHUD showError:@"报名失败"];
        }
        
 
        
    }];
}

@end
